<%--
 *  File:   Activity4CustomerType.jsp
 *  Date		  Author		  Changes
 *  2010-8-6	  visazhou		  Created
 *
 *  Copyright (C) 2000 - 2005 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
<%
	//init param
  	String privilegeCode = "All";
    String strModuleName = "COM";
  	String contextPath = request.getContextPath();
%>
<%@ include file="/inc/CommonHeader.inc" %>
<iframe name="reloadHandler" style="display:none"></iframe>
<html>
<head>
<title>Activity4CustomerType</title>
<PageFlow:CheckPageFlow pageName="p_activity4customertype"/>
<%@ include file="/inc/AlertError.inc" %>
<%
  Vector totalsummary = (Vector)pageContext.getAttribute("totalsummary");
  if(totalsummary == null) totalsummary = new Vector();
  String info = (String) request.getParameter("info");

%> 

<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<%
	HashMap Cuserinfo = (HashMap)session.getAttribute("userinfo");
   	if (Cuserinfo==null){
   		Cuserinfo = new HashMap();
   	}
   	String strIsFromHomepage1 = "N";
   	if (Cuserinfo.get("isFromHomepage1")!=null ){
   		strIsFromHomepage1 = (String)Cuserinfo.get("isFromHomepage1");
    }    
%>
<link rel="stylesheet" href="<%=contextPath %>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath%>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript">
function page_setItem(itemid)
{
    cform.itemid.value='';
    cform.itemname.value='';
    cform.umcode.value='';
    cform.umname.value='';
    if(itemid!=null)
    {
        cform.itemid.value = itemid;
        cform.itemcode.value = '';
    }
    page_handleRequest('<%=contextPath%>',cform);
}
function page_handleResponse()
{
    cform.itemid.value = getResponseData("itemid");
    cform.itemcode.value = getResponseData("itemcode");
    cform.itemname.value = getResponseData("itemname");
    cform.umcode.value = getResponseData("umcode");
    cform.umname.value = getResponseData("umname");
}
function page_add(){
   
    cform.actionname.value = "add";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}
function page_delete(){
    if(isNullChecked(cform.ids))
    {
        alert("<%= message.getMessageDesc("MUST_SELECT_ONE_RECORD_TO_DEL") %>");
        return;
    }
    if(!confirm("<%= message.getMessageDesc("ARE_YOU_SURE_DEL") %>")) return;
    cform.actionname.value = "delete";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}
function page_save()
{
    if(!checkALLElems(document.getElementById("olddetail"))) return;
    cform.actionname.value = "save111";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}
function set_orgNameByPopWindow(id,code,name){
	document.cform.brandcode.value=code;
	document.cform.brandname.value=name;
	document.cform.productbrandid.value=id;
}

function setNamebycode(code){
	var  codevalue = code.value;
	var  datahandler = new  DataHandler() ;
	
	datahandler.add_params("brandcode" , codevalue,"string") ;
  	datahandler.add_params("languagecode" , 'cn',"string") ;
  	
  	datahandler.getResultFromHashMap("info" ,"cn_brandname" ,"document.cform.brandname");
  	datahandler.getResultFromHashMap("info" ,"productbrandid" ,"document.cform.productbrandid");
  	datahandler.add_job("j_getnamebycode") ;
  	
    datahandler.runDataHandler ();
}

function selectattribute(){

var globalpccode = document.cform.globalpccode.value;

	//document.getElementById('attribute2div').style.display='none';
	//document.getElementById('nbspdiv').style.display='block';

var  datahandler = new  DataHandler() ;

datahandler.add_params("globalpccode" , globalpccode,"integer") ;
datahandler.add_params("languagecode" , 'cn',"string") ;
datahandler.getResultFromVector("attribute1","valuename" ,"value" ,"document.cform.attribute1") ;
datahandler.getResultFromVector("attribute2","valuename" ,"value" ,"document.cform.attribute2") ;
datahandler.add_job("j_attribute") ;
datahandler.runDataHandler ();


}

function allcheckselect(){
	var allcheck = cform.allcheck.checked;
	var allids = document.getElementsByName('ids');
	var length = allids.length;
	if(allcheck){
		for(var i = 0 ; i < length;i++){
			allids[i].checked = true;
		}
	}else{
		for(var i = 0 ; i < length;i++){
			allids[i].checked = false;
		}	
	}
}
</script>
<body style="overflow: auto;">
<form name="cform" method="post" action="<%=contextPath%>/Dispatcher" >
  <input type="hidden" name="pagename" value="p_activity4customertype">
  <input type="hidden" name="actionname">
  <input type="hidden" name="numrows" value="<%= totalsummary.size() %>">
  <custom:hidden property="userid" name="userinfo" scope="session"/>
  <custom:hidden property="activityconfigid" />
<table width="100%" cellspacing="0" border="0" cellpadding="0">
	<tr>
		<td>
		<table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0">
		<tr class="deepblue-left"> 
		<% if(!"Y".equals(info)){%>
          	<td width="5%" class="deepblue-left"><input type="checkbox" name="allcheck" class="normalradio" onclick="allcheckselect();"></td>
         <%} %>
          	<td width="30%" class="title_center">&nbsp;<%= label.getLabelName("L_GlobalPCName") %></td>
	  		<td class="title_center">&nbsp;<%= label.getLabelName("L_group1") %></td>
	  		
	  		<td width="20%" class="title_center">&nbsp;<%= label.getLabelName("L_group2") %></td>
        	
        </tr>
	    <span id="olddetail" >
       	<logic:iterate id="onerow" collection="<%= totalsummary %>" indexId="idx">
       	<tr>
       	<% if(!"Y".equals(info)){%>
         	<td width="30">
				<custom:checkbox property="activity4customertypeid" name="onerow" changedName="ids" styleClass="normalradio" />
         	</td>
         	<%} %>
	        <td><custom:write name="onerow" property="globalpccodename"nbsp="true" /></td>
	        <td><custom:write name="onerow" property="attribute1name" nbsp="true"/></td>
	  		<td><custom:write name="onerow" property="attribute2name" nbsp="true"/></td>
        	
    	</tr>
       	
        </logic:iterate>
		</span>
		<% if(!"Y".equals(info)){%>
		<span id="newdetail" >
       	<tr >
         	<td>&nbsp;</td>
           	<td><custom:selectdic name="newdetail" property="globalpccode" dictType="GlobalPCCode" valueCriteria="112-114" onchange="selectattribute()"/></td>
            <td>
            
               <custom:select optionsName="attribute1" optionValueKey="value" optionInnerTextKey="valuename" name="newdetail" property="attribute1"  defaultValue="------" defaultValueCost=""/>
               
	  		 <td>
	  		   <!-- <div id="attribute2div" style="display:none" > -->
	  		   		<custom:select optionsName="attribute2" optionValueKey="value" optionInnerTextKey="valuename" name="newdetail" property="attribute2" defaultValue="------" defaultValueCost=""  />
	  		   <!--</div> -->
	  		   </td>
        	
        <%} %>	
       	</tr>
		</span>
          
		</table>
		<%//--------------------------------------  page operation button --%>
		<table width="100%" cellspacing="0" cellpadding="0">
			<tr>
				<td class="summary_top"></td>
			</tr>
			<% if(!"Y".equals(info)){%>
			<tr>
				<td class="td_center"><a onclick="javascript:page_add();"><custom:button type="1" label="L_Save" imgsrc="finish.gif" border="0" style="width:60" /></a>
				<a onclick="javascript:page_delete();"><custom:button type="1" label="L_Delete" imgsrc="finish.gif" border="0" style="width:60" /></a></td>
			</tr>
			 <%} %>	
		</table>
		</td>
	</tr>
</table>

</form>
</body>
</html>